{extend name="template/base" /}
{block name="style"}
<link rel="stylesheet" type="text/css" href="__LIB__/oss-h5-upload-js-php/style.css"/>
<link rel="stylesheet" type="text/css" href="__LIB__/webuploader/0.1.5/webuploader.css" />
<link rel="stylesheet" type="text/css" href="__LIB__/fontawesome-4.2.0_ie7/4.2.0/css/font-awesome.min.css" />
{/block}

{block name="content"}
<div class="page-container">
    <form class="form form-horizontal" id="form" method="post" action="{:\\think\\Request::instance()->baseUrl()}">
        <input type="hidden" name="id" value="{$vo.id ?? ''}">
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">标题：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" placeholder="标题" name="title" value="{$vo.title ?? ''}" >
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">等级：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <select name="rank_id">
                    {volist name="rank_list" id="rank"}
                    {if $vo.rank_id==$rank.id}
                    <option value="{$rank.id}" selected>{$rank.name}</option>
                    {else}
                    <option value="{$rank.id}">{$rank.name}</option>
                    {/if}
                    {/volist}
                </select>
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">视频标题：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" placeholder="视频标题" name="video_title" value="{$vo.video_title ?? ''}" >
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">视频图片：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <!--dom结构部分-->
                <div id="video_img_id" class="uploader">
                    {php}
                    if($vo['video_img_id']){
                    $video_img_id=get_img_array($vo['video_img_id']);
                    }
                    {/php}
                    <!--用来存放item-->
                    <div  class="uploader-list fileList">
                        {volist name="video_img_id" id="video_img"}
                        <div id="video_img_{$video_img['id']}" class="file-item thumbnail upload-state-done">

                            <img width="100" height="100" src="{$video_img['url']}">
                            <div class="info">{$video_img['oname']}</div>
                            <div class="del fa fa-trash-o"> 删除 </div>
                            <input type="hidden" name="video_img_id[]" value="{$video_img['id']}">

                        </div>
                        <script>
                            window.onload=function(){
                                $('#video_img_{$video_img['id']}').on("click"," .del",function(){

                                    var $li = $('#video_img_{$video_img['id']}');
                                    $li.remove();
                                })
                            }
                        </script>
                        {/volist}
                    </div>
                    <div class="filePicker">选择图片</div>
                </div>
                <!--                <input type="number" class="input-text" placeholder="主图id" name="video_img_id" value="{$vo.video_img_id ?? ''}" >-->
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">视频路径：</label>
            <div class="formControls col-xs-6 col-sm-6">

                    <input type="radio" style="display: none" name="myradio" value="local_name" checked=true/>
                    <input type="radio" style="display: none" name="myradio" value="random_name" />


                <h4>您所选择的文件列表：</h4>
                <div id="ossfile">你的浏览器不支持flash,Silverlight或者HTML5！</div>

                <br/>


                <div id="container">
                    <a id="selectfiles" href="javascript:void(0);" class='btn'>选择文件</a>
                    <a id="postfiles" href="javascript:void(0);" class='btn'>开始上传</a>
                </div>

                <pre id="console" style="display: none"></pre>

                <p>&nbsp;</p>
                <input type="text" class="input-text" id="video_url" placeholder="视频路径" name="video_url" value="{$vo.video_url ?? ''}" >
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">视频长度：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" placeholder="视频长度" name="video_length" value="{$vo.video_length ?? ''}" >
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">内容标题：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" placeholder="内容标题" name="content_title" value="{$vo.content_title ?? ''}" >
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">内容：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <script id="content" name="content" type="text/plain" style="height:100px;width: 100%;">{:htmlspecialchars_decode($vo.content)}</script>
                </div>
                <div class="col-xs-3 col-sm-3"></div>
         </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">浏览量：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" placeholder="浏览量" name="view_num" value="{$vo.view_num ?? ''}" >
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>


        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <button type="submit" class="btn btn-primary radius">&nbsp;&nbsp;提交&nbsp;&nbsp;</button>
                <button type="button" class="btn btn-default radius ml-20" onClick="layer_close();">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
            </div>
        </div>
    </form>
</div>
{/block}
{block name="script"}
<script type="text/javascript" src="__LIB__/Validform/5.3.2/Validform.min.js"></script>
<script type="text/javascript" src="__LIB__/oss-h5-upload-js-php/lib/plupload-2.1.2/js/plupload.full.min.js"></script>
<script type="text/javascript" src="__LIB__/oss-h5-upload-js-php/upload.js"></script>
<script type="text/javascript" src="__LIB__/webuploader/0.1.5/webuploader.js"></script>
<script type="text/javascript" src="__LIB__/webuploader/0.1.5/image-upload/uploadimg.js"></script>
<script>window.UEDITOR_HOME_URL = '__LIB__/ueditor/1.4.3/'</script>
<script type="text/javascript" charset="utf-8" src="__LIB__/ueditor/1.4.3/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="__LIB__/ueditor/1.4.3/ueditor.all.js"></script>
<script type="text/javascript" charset="utf-8" src="__LIB__/ueditor/1.4.3/lang/zh-cn/zh-cn.js"></script>
<script>
    $(function () {
;
        upload_imgs("video_img_id");
        $('.skin-minimal input').iCheck({
            checkboxClass: 'icheckbox-blue',
            radioClass: 'iradio-blue',
            increaseArea: '20%'
        });
        var ue_content = UE.getEditor('content', {
            serverUrl: '{:\\think\\Url::build("Ueditor/index")}'
        });
        $("#form").Validform({
            tiptype: 2,
            ajaxPost: true,
            showAllError: true,
            callback: function (ret){
                ajax_progress(ret);
            }
        });
    })
</script>
{/block}
